<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="Bookmark" href="__ADMIN__/favicon.ico">
    <link rel="Shortcut Icon" href="__ADMIN__/favicon.ico"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__ADMIN__/lib/html5.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="__ADMIN__/static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="__ADMIN__/static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="__ADMIN__/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="__ADMIN__/static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="__ADMIN__/static/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="__ADMIN__/static/plugs/css/jquery-editable-select.css"/>
    <link href="__ADMIN__/static/plugs/css/select2.min.css" rel="stylesheet"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <!--/meta 作为公共模版分离出去-->

    <title>新增项目</title>
    <meta name="keywords" content="H-ui.admin v3.0,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
    <meta name="description" content="H-ui.admin v3.0，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<article class="page-container">
    <form action="create" method="post" class="form form-horizontal" id="form-project-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="" name="pname">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目类型：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box">
				<select id="project_type_select" name="ptype" class="select">
                    <!--					<option value="1">专题</option>-->
                    <!--					<option value="2">频道</option>-->
                    <!--					<option value="3">分网</option>-->
                    <!--					<option value="4">建站</option>-->
                    <!--					<option value="5">系统</option>-->
				</select>
				</span>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>CMS类型：</label>
            <div class="formControls col-xs-8 col-sm-9"> <span class="select-box">
				<select name="cms" class="select" id="cms_type_select">
<!--					                    <option value="0" selected>未分类</option>-->
<!--                    					<option value="1">阳光网CMS</option>-->
<!--                    					<option value="2">TRS</option>-->
<!--                    					<option value="3">织梦</option>-->
				</select>
				</span>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>开发人员：</label>
            <div class="formControls col-xs-8 col-sm-9">

                <select class="select" name="person" id="person_filter">
                    {volist name='users' id='vo' key='k'}
                    <option value="{$vo.id}" {eq value="$Think.session.user_id" name="$vo.id" }selected{/eq}>{$vo.name}</option>
                    {/volist}
                </select>


            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>开发语言：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select name="lang[]" class="select" multiple="multiple" id="lang_multiselect">
<!--                    <option value="1">php</option>-->
<!--                    <option value="2">java</option>-->
<!--                    <option value="3">python</option>-->
<!--                    <option value="4">asp</option>-->
<!--                    <option value="5">javascript</option>-->
<!--                    <option value="6">vue.js</option>-->
                </select>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>框架：</label>
            <div class="formControls col-xs-8 col-sm-9"> <span class="select-box">
				<select name="frame" class="select" id="frame_filter">
<!--					<option value="1">spring+hibernate+struts2</option>-->
<!--					<option value="2">spring+hibernate+xwork2.0</option>-->
<!--					<option value="3">spring+mybatis+springmvc</option>-->
<!--					<option value="4">Thinkphp</option>-->
<!--					<option value="5">codeigniter</option>-->
				</select>
				</span>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>前台地址：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="" name="front_url">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>后台地址：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="" name="back_url">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">服务器地址：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="" name="srv_url">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">git地址：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="" name="git">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">ftp目录：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="" name="ftp">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">代码目录：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="" id="" name="code_path">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">关联信息：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea name="relate_info" cols="" rows="" class="textarea" placeholder="请输入..." datatype="*10-100"
                          dragonfly="true" nullmsg="备注不能为空！" onKeyUp="textarealength(this,200)"></textarea>
                <p class="textarea-numberbar"><em class="textarea-length">-</em>/200</p>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">项目描述：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea name="desc" cols="" rows="" class="textarea" placeholder="请输入..." datatype="*10-100"
                          dragonfly="true" nullmsg="备注不能为空！" onKeyUp="textarealength(this,200)"></textarea>
                <p class="textarea-numberbar"><em class="textarea-length">-</em>/200</p>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <!--				<button onClick="article_save_submit();" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存并提交审核</button>-->
                <button class="btn btn-primary radius" type="submit" aria-hidden="true" data-dismiss="modal">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button class="btn btn-default radius" type="button" aria-hidden="true" data-dismiss="modal">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</article>

<!--_footer 作为公共模版分离出去-->
{include file="footer"}
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<!--<script type="text/javascript" src="__ADMIN__/lib/My97DatePicker/4.8/WdatePicker.js"></script>-->
<script type="text/javascript" src="__ADMIN__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="__ADMIN__/lib/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="__ADMIN__/static/plugs/js/jquery-editable-select.js"></script>
<script type="text/javascript" src="__ADMIN__/static/plugs/js/select2.min.js"></script>
<script type="text/javascript">
    $(function () {
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });


        $.ajax({
            'type': 'GET',
            'url': "{:url('admin/project/get_all_options')}",
            'success': function (res) {
                type_select(res);
            },
            'error': function () {
                console.log('错误');
            }
        });

        // 下拉单选框，可输入. 把可选项动态化之后，不需要可输入功能，故注释掉。
        // $('#cms_type_select').editableSelect({filter: false});
        // $('#frame_filter').editableSelect({filter: false});
        $('#person_filter').select2();

        // 下拉多选框，不可输入， 可搜索
        $('#lang_multiselect').select2();

        $("#form-project-add").validate({
            rules: {
                pname: {required: true},
                ptype: {required: true},
                cms: {required: true},
                person: {required: true},
                lang: {required: true},
                frame: {required: true},
                front_url: {required: true},
                back_url: {required: true},
            },
            onkeyup: false,
            focusCleanup: true,
            success: 'valid',
            submitHandler: function (form) {
                $(form).ajaxSubmit({
                    success: function (data) {
                        console.log(data);
                        if (data.code === 0) {
                            var index = parent.layer.getFrameIndex(window.name);
                            window.parent.location.reload();    // 刷新父页面
                            // parent.$('#btn-refresh').click();
                            parent.layer.close(index);          // 关闭当前的modal框

                        } else {
                            layer.msg(data.message, {icon: 5, time: 1000})
                        }
                    }
                })
            }
        });

        /*
		* 用于页面中 select下拉框 可选项的动态渲染
		* */
        function type_select(res) {
            console.log(res);
            let project_select_obj = document.getElementById('project_type_select');
            let cms_select_obj = document.getElementById('cms_type_select');
            let lang_select_obj = document.getElementById('lang_multiselect');
            let frame_select_obj = document.getElementById('frame_filter');

            for (let o of res) {
                if (o.type == "项目类型") {
                    for (let i of o.value) {
                        let option = new Option(i.name, i.id);
                        project_select_obj.appendChild(option);
                    }
                } else if (o.type == "cms类型") {
                    for (let i of o.value) {
                        let option = new Option(i.name, i.id);
                        cms_select_obj.appendChild(option);
                    }
                }else if (o.type == "开发语言"){
                    for (let i of o.value) {
                        let option = new Option(i.name, i.id);
                        lang_select_obj.appendChild(option);
                    }
                }else if (o.type =='框架'){
                    for (let i of o.value) {
                        let option = new Option(i.name, i.id);
                        frame_select_obj.appendChild(option);
                    }
                }
            }
            // select_obj.options[select_obj.options.length] = new Option('Text 1', 'Value1');
        }
    });
</script>
</body>
</html>